﻿<phone:PhoneApplicationPage  
    x:Class="VRacer.RacePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:VRacer="clr-namespace:VRacer"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="False">
    <phone:PhoneApplicationPage.Resources>

    </phone:PhoneApplicationPage.Resources>


    <Grid >

        <ScrollViewer Name="svMap" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">


            <Canvas Name="cnvMap" Width="1024" Height="1024" ManipulationDelta="cnvMap_ManipulationDelta">
                <!--<Canvas.Background>
                    <ImageBrush ImageSource="/VRacer;component/BoxBackground.png" Stretch="UniformToFill" />
                </Canvas.Background>-->
                <VRacer:TiledBackground Canvas.Top="0" Canvas.Left="0"  SourceUri="/VRacer;component/road.jpg" Width="1024" Height="1024" Visibility="Visible" />
                <Image Name="imgMap" Width="1024" Height="1024"/>
                <VRacer:Car x:Name="carDefault" Canvas.Left="221" Canvas.Top="684" RenderTransformOrigin="0.5,0.5"  IsHitTestVisible="True" Height="50" Width="20">
                    <VRacer:Car.RenderTransform>
                        <CompositeTransform Rotation="0"/>
                    </VRacer:Car.RenderTransform>
                </VRacer:Car>



            </Canvas>
        </ScrollViewer>
        <StackPanel Orientation="Vertical">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="0" Name="tbSpeed" Foreground="Black" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontSize="22" IsHitTestVisible="False" />
                <Button Name="btnReset" Content="Reset Race" BorderBrush="#FF270F0F" Foreground="#FF211D1D" Click="btnReset_Click" />
                <Button Name="btnNext" Content="Next Step" Click="btnNext_Click" />
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="CurrentSpeed: "  Foreground="Black" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontSize="22" />
                <TextBlock Text="0" Name="tbCurrentSpeed" Foreground="Black" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontSize="22" />
            </StackPanel>
            <TextBlock Name="tbOut" Text="Out of the road!!!" Foreground="Red" FontWeight="Bold" Visibility="Collapsed"/>
        </StackPanel>

        <Canvas Name="cnvVelocity" Width="300" Height="300"  HorizontalAlignment="Center" VerticalAlignment="Center">
            <Ellipse Name="elVelocity" VerticalAlignment="Center" HorizontalAlignment="Center" Width="300" Height="300" ManipulationStarted="Car1_ManipulationStarted" ManipulationDelta="Car1_ManipulationDelta" ManipulationCompleted="Car1_ManipulationCompleted" Canvas.Left="0" Canvas.Top="0">
                <Ellipse.Projection>
                    <PlaneProjection/>
                </Ellipse.Projection>

                <Ellipse.Fill>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#2300FF00" Offset="0.418" />
                        <GradientStop Color="#23FF0000" Offset="0.692" />
                    </LinearGradientBrush>
                </Ellipse.Fill>
            </Ellipse>
        </Canvas>
    </Grid>

</phone:PhoneApplicationPage>